﻿var formTypeData=[{code:'0',name:'水费'},{code:'1',name:'电费'}];
var areaData=[{code:'0',name:'公摊'},{code:'1',name:'住宅'},{code:'2',name:'门面'},{code:'3',name:'其它'}];
var emptyData={total:0,rows:[]};

//初始化入口
$(function() {


    $('#cbformType').combobox('loadData', formTypeData);
    $('#cbarea').combobox('loadData', areaData);
    $('#cbformType').combobox('setValue', '0');
    $('#cbarea').combobox('setValue', '0');

    $('#makeformlistGird').datagrid('options').onSelect = function(rowIndex, rowData) {
        $('#formorderGrid').datagrid('options').url = '../Controller.aspx?controller=MakeFormController&method=GetMakeOrderList&MeterHeadId=' + rowData.MeterHeadId;
        $('#formorderGrid').datagrid('reload');
    };
});


function MeterNumStyler(value){
    return 'background-color:#efefef;color:red;';
}

function typeFormatter1(value){
   
	for(var i=0; i<areaData.length; i++){
		if (areaData[i].code == value) return areaData[i].name;
	}
	return value;
}

function typeFormatter2(value){
    for(var i=0; i<formTypeData.length; i++){
		if (formTypeData[i].code == value) return formTypeData[i].name;
	}
	return value;
}

function btn_searchmakeform(){
    var bdate=$('#bdate').datebox('getValue');
    var edate=$('#edate').datebox('getValue');
    var meterType=$('#cbarea').combobox('getValue');
    var meterType2=$('#cbformType').combobox('getValue');
    $('#makeformlistGird').datagrid('options').url='../Controller.aspx?controller=MakeFormController&method=GetHistoryMakeformList&bdate='+bdate+'&edate='+edate+'&meterType='+meterType+'&meterType2='+meterType2;
    $('#makeformlistGird').datagrid('reload');
    
    $('#formorderGrid').datagrid('loadData',emptyData);
}